//
// Created by shanshi on 18/6/2025.
//

#include <iostream>
#include <map>
#include <vector>

using namespace std;
// case 1
#if 0
void print_size_capacity(vector<int>& v, vector<int>& v1) {
    std::cout<< "v size()" <<v.size()<< std::endl;
    cout<< "v capacity()" << v.capacity()<<endl;
    std::cout<< "v1 size()" <<v1.size()<< std::endl;
    cout<< "v1 capacity()" << v1.capacity()<<endl;
}
void print_vector(vector<int>& v, vector<int>& v1) {
    cout << "v:" << " ";
    for( auto i : v) {
        cout<< i << " ";
    }
    cout<<endl;
    cout << "v1:" << " ";
    for( auto i : v1) {
        cout<< i << " ";
    }
    cout<<endl;
}
int main() {
    std::vector<int> v;
    std::vector<int> v1 = {1,2,3,4,5,6,7,8,9,10};
    print_size_capacity(v, v1);
    print_vector(v, v1);
    cout<< "--------swap------" << endl;
    v.swap(v1);
    print_size_capacity(v, v1);
    print_vector(v, v1);
    cout<< "--------clear------" << endl;
    v1 = v;
    v.clear();
    print_size_capacity(v, v1);
    print_vector(v, v1);
    cout<< "--------resize------" << endl;
    v.resize(5);
    print_size_capacity(v, v1);
    print_vector(v, v1);
    cout<< "--------shrink_to_fit------" << endl;
    v.shrink_to_fit();
    print_size_capacity(v, v1);
    print_vector(v, v1);
}
#endif

//case 2
#if 1
int main() {
    // std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    // vector<int>::iterator it = v.begin();
    // cout << *it << endl;
    // cout << *(it + 1) << endl;
    // *it = 100;
    // cout << *it << endl;
    // cout << *(++it) << endl;
    map<int, int> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9}, {10, 10}};
    m.insert(pair<int, int>(11, 11));
    for (map<int,int>::iterator it = m.begin(); it != m.end(); it++) {
        cout << it->first << " " << it->second << endl;
    }
}
#endif
